#include "Poller.h"
#include "Channel.h"

Poller::Poller(EventLoop* loop)
    : ownerLoop_(loop)
{}

// 判断当前poller里是否拥有某个channel
bool Poller::hasChannel(Channel* channel) const
{
    // using ChannelMap = std::unordered_map<int, Channel*>
    auto it = channels_.find(channel->fd());
    return it != channels_.end() && it->second == channel;  // key存在且value相等才返回true
}